version: '3.9'

volumes:
  redis_data: {}
  app_data: {}
  
services:
  redis:
    container_name: wissance_ferrum_db
    hostname: redis
    image: "redis/redis-stack:7.2.0-v2"
    env_file:
      - settings.env
    restart: always
    volumes:
      - redis_data:/data
    environment:
      REDIS_ARGS: "--user ferrum_db on >FeRRuM000 allkeys allchannels allcommands --user default off --save 20 1"
    ports:
      - "6379:6379"
      - "8001:8001"
    expose:
      - "6379"
      - "8001"

  ferrum:
    container_name: wissance_ferrum_webapi
    hostname: ferrum
    stdin_open: true
    tty: true
    env_file:
      - settings.env
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - app_data:/data
    environment:
      WAIT_HOSTS: redis:6379
    depends_on:
      redis:
        condition: service_started
    ports:
      - "8182:8182"
    expose:
      - "8182"
